﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ResultControl.ascx.cs" Inherits="PayrollHR.Administration.Modules.ResultControl" %>
<%@ Register Src="ConfirmationBox.ascx" TagName="ConfirmationBox" TagPrefix="uc2" %>
<%@ Register Src="ToolTipLabelControl.ascx" TagName="ToolTipLabelControl" TagPrefix="uc1" %>
<%@ Register Src="DatePicker.ascx" TagName="DatePicker" TagPrefix="uc3" %>
<script type="text/javascript">
    $(window).bind('load', function () {
        var cbHeader = $(".cbHeader input");
        var cbRowItem = $(".cbRowItem input");
        cbHeader.bind("click", function () {
            cbRowItem.each(function () { this.checked = cbHeader[0].checked; })
        });
        cbRowItem.bind("click", function () { if ($(this).checked == false) cbHeader[0].checked = false; });
    });
    function ClearText() {
        document.getElementById('<%=txtCustomerName.ClientID%>').value = '';
        document.getElementById('<%=txtPackName.ClientID%>').value = '';
        document.getElementById('<%=txtMaCode.ClientID%>').value = '';
        document.getElementById('<%=txtCustName.ClientID%>').value = '';
        document.getElementById('<%=txtCustEmail.ClientID%>').value = '';
        document.getElementById('<%=txtTaxcode.ClientID%>').value = '';
        document.getElementById('<%=txtMobile.ClientID%>').value = '';
    };
</script>

<asp:UpdatePanel ID="upEmailReceive" runat="server">
    <ContentTemplate>
        <div class="section-header">
            <div class="title">
                <%=GetLocaleResourceString("Admin.CusomerResultManager.ManagerCustomerResult")%>
            </div>
            <div class="options">
                <asp:Button ID="btnFilter" runat="server" Text="Filter" OnClick="btnFilter_Click"
                    CssClass="adminButtonBlue" ToolTip="Filter" />
                <asp:Button ID="btnConfirm" runat="server" Text="Confirm And SendMail" OnClick="btnConfirm_Click"
                    CssClass="adminButtonBlue" ToolTip="Send to Queued And SendMail each 60s." />
                <uc2:ConfirmationBox ID="cbConfirm" runat="server" TargetControlID="btnConfirm"
                    YesText="<% $PayrollResources:Admin.Common.Yes %>" NoText="<% $PayrollResources:Admin.Common.No %>"
                    ConfirmText="<% $PayrollResources:Admin.Common.ConfimAndSendMail %>" />
                <asp:Button runat="server" Text="Delete" CssClass="adminButtonBlue" ID="btnDelete" ToolTip="Delete Mail" OnClick="btnDelete_Click" />
                <uc2:ConfirmationBox ID="cbDelete" runat="server" TargetControlID="btnDelete"
                    YesText="<% $PayrollResources:Admin.Common.Yes %>" NoText="<% $PayrollResources:Admin.Common.No %>"
                    ConfirmText="<% $PayrollResources:Admin.Common.AreYouSure %>" />
            </div>
        </div>
        <div>
            <div style="border: 1px solid #2F00FF; border-radius: 15px;">
                <div class="title">
                    <table style="width: auto">
                        <tr id="row1">
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl runat="server" ID="lblChannelTitle" Text="<% $PayrollResources:Admin.CustomerSearch.Distributor.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.Distributor.ToolTip %>"
                                    ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtCustomerName" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl ID="lblCustMobile" runat="server" Text="<% $PayrollResources:Admin.CustomerResultInfo.PackName.Text %>"
                                    ToolTip="<% $PayrollResources:Admin.CustomerResultInfo.PackName..ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtPackName" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>

                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl ID="ToolTipLabelControl1" runat="server" Text="<% $PayrollResources:Admin.CustomerResultInfo.MaCode.Text %>"
                                    ToolTip="<% $PayrollResources:Admin.CustomerResultInfo.MaCode.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtMaCode" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                            <td class="adminTitle">
                                <a id="aCleare" href="javascript:ClearText()">Clear Text </a>
                            </td>
                            <asp:HiddenField ID="hfdUserId" runat="server" />
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl6" Text="<% $PayrollResources:Admin.CustomerSearch.CustName.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.CustName.ToolTip %>"
                                    ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtCustName" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl ID="lblCustEmail" runat="server" Text="<% $PayrollResources:Admin.ResultSearchInfo.DistributorEmail.Text %>"
                                    ToolTip="<% $PayrollResources:Admin.ResultSearchInfo.DistributorEmail.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtCustEmail" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl ID="lblCustCompany" runat="server" Text="<% $PayrollResources:Admin.CustomerInfo.CustTaxCode.Text %>"
                                    ToolTip="<% $PayrollResources:Admin.CustomerInfo.CustTaxCode.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtTaxcode" runat="server" MaxLength="32" CssClass="adminInput"></asp:TextBox>
                            </td>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl ID="ToolTipLabelControl4" runat="server" Text="<% $PayrollResources:Admin.CustomerInfo.CustMobile.Text %>"
                                    ToolTip="<% $PayrollResources:Admin.CustomerInfo.CustMobile.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:TextBox ID="txtMobile" CssClass="adminInput" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl2" Text="<% $PayrollResources:Admin.CustomerSearch.From.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.From.ToolTip %>"
                                    ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <uc3:DatePicker ID="dpFromdate" runat="server" />
                            </td>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl3" Text="<% $PayrollResources:Admin.CustomerSearch.To.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.To.ToolTip %>"
                                    ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <uc3:DatePicker ID="dpTodate" runat="server" />
                            </td>
                            <td class="adminTitle">
                                <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl5" Text="<% $PayrollResources:Admin.CustomerSearch.Confirm.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.Confirm.ToolTip %>"
                                    ToolTipImage="~/Administration/Common/ico-help.gif" />
                            </td>
                            <td class="adminData">
                                <asp:CheckBox ID="ckConfirm" runat="server" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <p></p>
        <asp:GridView ID="gvMail" runat="server" ForeColor="#333333" CellPadding="4" AutoGenerateColumns="False" Width="100%" DataKeyNames="ResultsId" AllowPaging="True"
            PageSize="30" OnPageIndexChanging="gvMail_PageIndexChanging" OnRowUpdating="gvMail_RowUpdating" OnRowEditing="gvMail_RowEditing" OnRowCancelingEdit="gvMail_RowCancelingEdit">
            <Columns>
                <asp:TemplateField ItemStyle-Width="0.5%" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        <asp:CheckBox ID="cbSelectAll" runat="server" CssClass="cbHeader" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="cbResult" runat="server" CssClass="cbRowItem" ToolTip="<% $PayrollResources:Admin.Customers.Result.ToolTip %>" />
                        <asp:HiddenField ID="hfResultsId" runat="server" Value='<%# Eval("ResultsId") %>' />
                        <asp:HiddenField ID="hfCustomerId" runat="server" Value='<%# Eval("CustomerId") %>' />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="0.5%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="NPP" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblDistributor" Text='<%#Eval("Distributor") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="10%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="T.Thái"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <%#Server.HtmlEncode(Eval("status").ToString())%>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="3%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên Khách Hàng" ItemStyle-Width="16%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblCustomerName" Text='<%#Eval("CustomerName") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtCustomerName" runat="server" TextMode="MultiLine" Width="100%" Text='<%# Eval("CustomerName") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemStyle Width="16%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tax Code"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="6%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblTaxCode" Text='<%#Eval("TaxCode") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtTaxCode" runat="server" TextMode="MultiLine" Width="100%" Text='<%# Eval("TaxCode") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="6%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mobile"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblMobile"  Text='<%#Eval("Mobile") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtMobile" runat="server" TextMode="MultiLine" Width="100%" Text='<%# Eval("Mobile") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="7%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblDatePurchase" Text='<%#Eval("DatePurchase") %>' ToolTip="dd/MM/yyyy"></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtDatePurchase" runat="server" TextMode="MultiLine" Width="100%" ToolTip="dd/MM/yyyy" Text='<%# Eval("DatePurchase") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="7%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã Code"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="8%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblPackageCode" Text='<%#Eval("PackageCode") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtPackageCode" runat="server" Width="100%" TextMode="MultiLine" Text='<%# Eval("PackageCode") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="8%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên Gói"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblName" Text='<%#Eval("Name") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="7%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Địa Chỉ"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="8%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblAddress" Text='<%#Eval("Address") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="8%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Phí"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblServiceFree" Text='<%#Eval("ServiceFree") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Hồ sơ"
                    HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblCustomerProfile" Text='<%#Eval("CustomerProfile") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtCustomerProfile" runat="server" Width="100%" TextMode="MultiLine" Text='<%# Eval("CustomerProfile") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="10%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Edit" ShowHeader="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="3%" ItemStyle-HorizontalAlign="Left">

                    <ItemTemplate>
                        <asp:LinkButton ID="btnedit" runat="server"
                            CommandName="Edit" Text="Edit"></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:LinkButton ID="btnupdate" runat="server"
                            CommandName="Update" Text="Update"></asp:LinkButton>
                        <asp:LinkButton ID="btncancel" runat="server"
                            CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                    <ItemStyle HorizontalAlign="Left" Width="3%" />
                </asp:TemplateField>
            </Columns>
            <PagerSettings PageButtonCount="50" Position="TopAndBottom" />
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="up1" runat="server" AssociatedUpdatePanelID="upEmailReceive">
    <ProgressTemplate>
        <div class="progress">
            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/images/UpdateProgress.gif"
                AlternateText="update" />
            <%=GetLocaleResourceString("Admin.Common.Wait...")%>
        </div>
    </ProgressTemplate>
</asp:UpdateProgress>
